﻿@model IDictionary<string, object>
@using Pku.BookStore.Model;
@{
    var bookModel = (ProductModel)Model["bookModel"];

    ViewBag.Title = bookModel.BookName;
}
<link href="/Content/book.pshow.css" rel="stylesheet" type="text/css" />
<div class="w main">
    <div class="right-extra">
        <div id="name" pshowskuid="10840535">
            <h1>
                @bookModel.BookName</h1>
        </div>
        <!--pname end-->
        <div id="preview">
            <div id="spec-n1" class="jqzoom">
                <img onerror="this.src=&#39;/images/none_347.gif&#39;"
                    src="@bookModel.Image"
                    width="280" height="280" alt="@bookModel.BookName">
            </div>
            <ul class="extra">
            </ul>
        </div>
        <!--preview end-->
        <ul id="summary" clstag="book|keycount|product|summary">
            <li>作 者：@bookModel.Author</li>
            <li><span>出 版 社：</span> <a target="_blank" href="/Publisher/List/@bookModel.PublisherId">@bookModel.PublisherName</a></li>
            <li><span>ＩＳＢＮ：</span>@bookModel.ISBN</li>
            <li><span>出版时间：</span>@bookModel.PublishDate.ToString("yyyy-MM-dd")</li>
            <li><span>所属分类：</span>@bookModel.CategoryName </li>
            <li class="extra">
                <div>
                    商品编号：@bookModel.BookID</div>
            </li>
        </ul>
        <!--summary end-->
        <ul id="book-price">
            <li>定&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;价：<del>￥@bookModel.Price</del></li>
            <li>本&nbsp;&nbsp;站&nbsp;&nbsp;价：<span id="priceinfo" class="price">￥@bookModel.TruePrice</span><span
                class="rate" id="pricediscount">@(bookModel.isSpecial == 1 ? "（特价）" : "")</span></li>
        </ul>
        <div class="m" id="choose">
            <script type="text/javascript">
                var setAmount = {
                    min: 1,
                    max: 999,
                    reg: function (x) {
                        return new RegExp("^[1-9]\\d*$").test(x);
                    },
                    amount: function (obj, mode) {
                        var x = $(obj).val();
                        if (this.reg(x)) {
                            if (mode) {
                                x++;
                            } else {
                                x--;
                            }
                        } else {
                            alert("请输入正确的数量！");
                            $(obj).val(1);
                            $(obj).focus();
                        }
                        return x;
                    },
                    reduce: function (obj) {
                        var x = this.amount(obj, false);
                        if (x >= this.min) {
                            $(obj).val(x);
                        } else {
                            alert("商品数量最少为" + this.min);
                            $(obj).val(1);
                            $(obj).focus();
                        }
                    },
                    add: function (obj) {
                        var x = this.amount(obj, true);
                        if (x <= this.max) {
                            $(obj).val(x);
                        } else {
                            alert("商品数量最多为" + this.max);
                            $(obj).val(999);
                            $(obj).focus();
                        }
                    },
                    modify: function (obj) {
                        var x = $(obj).val();
                        if (x < this.min || x > this.max || !this.reg(x)) {
                            alert("请输入正确的数量！");
                            $(obj).val(1);
                            $(obj).focus();
                        }
                    }
                }

                function BuyUrl(wid) {
                    var pcounts = $("#pamount").val();
                    var patrn = /^[0-9]{1,4}$/;
                    if (!patrn.exec(pcounts)) {
                        pcounts = 1;
                    }
                    else {
                        if (pcounts <= 0)
                            pcounts = 1;
                        if (pcounts >= 1000)
                            pcounts = 999;
                    }
                    $("#InitCartUrl").attr("href", "/Cart/?BookID=@bookModel.BookID&Num=" + pcounts + "&Act=A");
                }
				</script>
            <dl class="amount">
                <dt>我要买：</dt>
                <dd>
                    <a class="reduce" onclick="setAmount.reduce(&#39;#pamount&#39;)" href="javascript:void(0)">
                        -</a>
                    <input type="text" value="1" id="pamount" onkeyup="setAmount.modify(&#39;#pamount&#39;)">
                    <a class="add" onclick="setAmount.add(&#39;#pamount&#39;)" href="javascript:void(0)">
                        +</a>
                </dd>
                <dd class="text">
                    本</dd>
            </dl>
            <div class="btns">
                <a id="InitCartUrl" onclick="BuyUrl(10840535);mark(10840535,2);" href="#"
                    class="btn-append" clstag="book|keycount|product|btnappend">添加到购物车</a>
                <input type="button" value="收&#160;藏" class="btn-coll" id="coll10840535" clstag="book|keycount|product|btncoll" onclick="location.href='/User/FavoritesAct/@bookModel.BookID?Act=A'">
                <div class="clr">
                </div>
            </div>
            <div class="clr">
            </div>
        </div>
        <!--choose end-->
        <span class="clr"></span>
        <div class="m m1" clstag="book|keycount|product|mm1">
            <div class="mt">
                <h2>
                    内容简介
                </h2>
            </div>
            <div class="mc">
                <div class="con">
                    @bookModel.Introduction
                </div>
            </div>
        </div>
        <div class="m m1">
            <div class="mt">
                <h2>
                    推荐
                </h2>
            </div>
            <div class="mc">
                <div class="con" style="height: 288px; overflow: hidden;">
                    @bookModel.Recommend
                </div>
            </div>
        </div>
        <div class="m m1">
            <div class="mt">
                <h2>
                    目录
                </h2>
            </div>
            <div class="mc">
                <div class="con" style="height: 288px; overflow: hidden;">
                    @bookModel.Directory
                </div>
            </div>
        </div>
        <!--correction end-->
        <div class="m" id="comment" clstag="book|keycount|product|comment" load="true">
            <ul class="tab">
                <li data="5">商品评价<strong id="cnum1"></strong><span></span></li>
            </ul>
            <div class="mc tabcon" id="comment-0" style="display: block;">
                @foreach (var item in (List<CommentModel>)Model["commentList"])
                {
                    <div class="item">
                        <div class="user">
                            <div class="u-name">
                                @item.UserName</div>
                            <div class="date-buy">
                                评论日期<br>
                                @item.AddDate.ToString("yyyy-MM-dd")</div>
                        </div>
                        <div class="i-item">
                            <div class="o-topic">
                                <strong class="topic">@item.Title</strong><span class="date-comment">
                                    @item.AddDate</span></div>
                            <div class="comment-content">
                                @item.Content
                            </div>
                        </div>
                        <div class="corner tl">
                        </div>
                        <div class="corner tr">
                        </div>
                        <div class="corner b">
                        </div>
                        <div class="corner bl">
                        </div>
                        <div class="corner br">
                        </div>
                    </div>
                }
                <!--item end-->
            </div>
            <!--tabcon end-->
            <div class="mc tabcon hide" id="comment-1">
                <div class="iloading">
                    正在加载中，请稍候...</div>
            </div>
            <div class="mc tabcon hide" id="comment-2">
                <div class="iloading">
                    正在加载中，请稍候...</div>
            </div>
            <div class="mc tabcon hide" id="comment-3">
                <div class="iloading">
                    正在加载中，请稍候...</div>
            </div>
        </div>
        <!--comment end-->
    </div>
    <!--right-extra end-->
    <div class="left">
        <div class="m m0" id="hot-commodity" clstag="book|keycount|product|hotcommodity">
            <div class="mt">
                <h2>
                    同类热销商品<br>
                    <span>Similar Bestselling Titles</span></h2>
                <div class="extra">
                </div>
            </div>
            <div class="mc">
                <ul>
                    @foreach (var item in (List<ProductModel>)Model["productList"])
                    {
                        <li class="fore"><b></b><a href="/Product/Detail/@item.BookID" target="_blank">@item.BookName</a></li>
                    }
                </ul>
            </div>
        </div>
        <!--hot-commodity end-->
    </div>
    <!--left end-->
    <span class="clr"></span>
</div>
